﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.Linq;
using System.Web.Security;

namespace Blog
{
    public partial class Navigation : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                XDocument doc = XDocument.Load(Server.MapPath("~/App_Data/Blog.xml"));
                var res = (from post in doc.Descendants("post")
                          select new ListItem
                          {
                              Text = post.Attribute("author").Value,
                              Value = post.Attribute("author").Value
                          }).Distinct();

                foreach (var li in res)
                {
                    uiUsernames.Items.Add(li);
                }

                //hvis brugeren er logget ind så vis menu efter role
                //MembershipUser membershipUser = Membership.GetUser();
                

                //if(User.Identity.IsAuthenticated)

            }
        }
    }
}